#include "WizardBidState.h"
#include "WizardTrickState.h"

GamePlayer* WizardTrickState::getActivePlayer()
{
	return NULL; // TODO stub
} // end GameState method

GameState* WizardTrickState::getNextSequence()
{
	/*
		Scoring occurs at the end of a round, and gives REWARDS or PENALTIES
		- never both.
		REWARD:		condition =	you matched your bid in the amount of tricks won
					value =		20 + 10 * bid
		PENALTY:	condition = you fell short, or overshot, your bid
					value =		-10 * abs(bid-trickCount)
	*/
	/*CardNumber* bidsThisRound = bidsBySeat;
	CardNumber bid;
	CardNumber made;*/

	for (auto i = playerCount; i--;)
		startOfRoundScores[i] += score(i);/*((bid = bidsThisRound[i]) == (made = tricksTaken[i]))
			? FLAT_BID_REWARD + bid * PER_BID_REWARD
			: (bid < made ? bid - made : made - bid) * PER_BID_PENALTY;*/

	memset(bidsBySeat, 0, sizeof(CardNumber) * playerCount);

	// Wizard ends when a predetermined quantity of rounds complete.
	// The predetermined number is the deck size (60) divided by the number of players.
	// The design of Wizard ensures that this quotient is always a whole number.
	if (WizardCard::count() / playerCount == roundNumber)
		return NULL;
	
	// Dealer status rotates around the table each round.
	dealingSeat = NEXT_SEAT[dealingSeat];

	// Increase the amount of cards dealt to each player.
	++roundNumber;

	dealHands();

	return new WizardBidState();
} // end GameState method

ExpectedValue WizardTrickState::score(SeatNumber seat)
{
	return -1; // TODO stub
} // end GameState method

void WizardTrickState::transitionFrom(GameState* bid)
{
	// TODO stub
} // end GameState method
